#pragma once

#include <AVUIObject.h>
#include <AVUIEvent.h>

namespace AVUI
{

typedef ItemStructList< TRefCountedPtr<Delegate> > EventStorage;
class Delegate;
class EventRegistration;
class EventRoute;
class EventHandlersStore;

class EventableObject : public Object
{
public:
    EventableObject() { }

protected:

    void AddEventHandler(Object* pvKey, Delegate* pEventHandler);
    void RemoveEventHandler(Object* pvKey, Delegate* pEventHandler);
    void InvokeEventHandler(Object* pvKey, Object* pSender, Object* pArgs);
    void ClearEventHandlers(Object* pvKey);
    void AddHandlersToStorage(Object* pEvent, EventStorage* pStorage);

    EventHandlersStore* get_EventHandlersStore();
    TRefCountedPtr<EventHandlersStore> m_pEventHandlersStore;
};



}
